package com.yunxi.service.dubboService.impl.finance;

import com.github.pagehelper.PageInfo;
import com.yunxi.finance.pojo.InsurerVO;
import com.yunxi.finance.service.InsurerDubboService;
import com.yunxi.model.insurer.Insurer;
import com.yunxi.service.localService.insurer.InsurerService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * <p>
 * 保险公司 服务实现类
 * </p>
 *
 * @author 
 * @since 2019-05-14
 */
public class InsurerDubboServiceImpl implements InsurerDubboService {

    @Autowired
    @Qualifier(value = "insurerServiceImpl")
    InsurerService insurerService;


    @Override
    public InsurerVO getById(String id) throws InvocationTargetException, IllegalAccessException {
    Insurer insurer = insurerService.getById(id);
    InsurerVO insurerVO = new InsurerVO();
        BeanUtils.copyProperties(insurer,insurerVO);
        return insurerVO;
    }

    @Override
    public void saveOrUpdate(InsurerVO insurerVO) throws InvocationTargetException, IllegalAccessException {
    Insurer insurer = new Insurer();
        BeanUtils.copyProperties(insurerVO,insurer);
    insurerService.saveOrUpdate(insurer);
    }

    @Override
    public void removeById(String id) {
    insurerService.removeById(id);
    }

    @Override
    public PageInfo<InsurerVO> findPageByVO(InsurerVO insurerVO, Integer pageNum, Integer pageSize) throws InvocationTargetException, IllegalAccessException {

      PageInfo<InsurerVO> pageInfo = insurerService.pageByVo(insurerVO,pageNum,pageSize);

      return pageInfo;

   }

    @Override
    public void removeByList(List<InsurerVO> insurerVOList) throws IllegalAccessException, InvocationTargetException, InstantiationException {
        insurerService.removeByListVo(insurerVOList);
    }

    @Override
    public List listByVo(InsurerVO insurerVO) {
        return insurerService.listByVo(insurerVO);
    }
}
